<template>
  <view style="background-color: #fff;">
    <view v-if="star.length==0">
        <view class="img-box">
          <image src="../../static/star.jpg" mode="widthFix"></image>
        </view>
      
      <!-- <view style="height: 500px;width: 100%; background-color: #fff;"> -->
        
      <!-- </view> -->
    </view>
    <uni-swipe-action>
    <view class="star-box" v-for="(goods,i) in star" :key="i" >
      <uni-swipe-action-item :right-options="options" @click="swpierItemHandler(goods)">
      <my-goods :goods="goods"></my-goods>
      </uni-swipe-action-item>
    </view>
    </uni-swipe-action>
  </view>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from "vuex"
  export default {
    computed: {
      ...mapState('m_star', ['star'])
    },
    data() {
      return {
        options: [{
          text: '删除',
          style: {
            backgroundColor: '#c00000'
          },
        }]
      };
    },
    methods: {
      ...mapMutations('m_star', ['cancelStar']),
      gotoGoodsDetail(item) {
        uni.navigateTo({
          url: "/subpkg/good_detail/good_detail?goods_id=" + item.goods_id
        })
      },
      swpierItemHandler(goods){
        this.cancelStar(goods.goods_id)
      }
    }
  }
</script>

<style lang="scss">
.img-box{
  padding: 400rpx 0;
  image{
    display: block;
    margin: 0 auto;
  }
}
</style>
